home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC18AccessPriv / UGlobals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-24  |  3.9 KB  |  126 lines  |  [TEXT/pdos]

  1. /***********************************************************************
  2. *
  3. * AccessPriv uglobals.c
  4. *
  5. * Copyright (c)
  6. * Apple Computer, Inc.  1989-1990
  7. * All Rights Reserved.
  8. *
  9. * Developer Technical Support Apple II Sample Code
  10. *
  11. * This file contains the global variables used by the program.
  12. *
  13. ***********************************************************************/
  14.  
  15. #include "ap.h"
  16.  
  17. #include <quickdraw.h>
  18. #include <window.h>
  19. #include <control.h>
  20. #include <types.h>
  21. #include <stdfile.h>
  22. #include <GSOS.h>
  23. #include <AppleShare.h>
  24.  
  25. unsigned int    suppressErrors;     /* Used so user can cancel SFMultiGet2 */
  26. unsigned int    userID;             /* returned from MMStartUp */
  27. unsigned int    quitFlag = 0;       /* True when quitting */
  28. unsigned int    staggerCount = 0;   /* Used to stagger windows as they open */
  29. WmTaskRec       event;              /* All events are returned here */
  30.  
  31. GrafPortPtr     windowList[NumWindows]; 
  32. handle          PrivCtrlHndls[7][3];
  33. ptr             mysubsttext[9];
  34. GetAccessRightsRec curaccessprivs;
  35. SetAccessRightsRec newaccessprivs;
  36.  
  37. GSString32Ptr   DirEntryNamePtr;
  38. ResultBuf32     DirEntryResultBuf;
  39. DirEntryRecGS   myGetDirEntryRec;
  40.  
  41. UserInfoRec     ASuserinfoRec;
  42.  
  43. GetPrivilegesRec ASgetprivsRec;
  44. SetPrivilegesRec ASsetprivsRec;
  45. ResultBuf255    ownernametoget, ownernametoset;
  46. ResultBuf255    groupnametoget, groupnametoset;
  47. ResultBuf255    usernametoget, usergroupnametoget, SFpathresult;
  48. GSString255     foldertogetsetprivsof, volname;
  49.  
  50. GSString255Ptr  pathstrPtr;
  51.  
  52. char            hastheseprivs[60],blanks[255];
  53.  
  54. byte            power2[3];
  55. unsigned int    userisowner;
  56.  
  57.     
  58. multiReplyRecord myReply;
  59.  
  60.  
  61. extern int      _toolErr;
  62.  
  63.  
  64. void initAShareFSTSpecificPBs()
  65. {
  66.     ASgetprivsRec.pCount = 6;
  67.     ASgetprivsRec.fstNum = appleShareFSID;
  68.     ASgetprivsRec.commandNum = ASGetPrivileges;
  69.     ASgetprivsRec.pathname = &foldertogetsetprivsof;
  70.     ASgetprivsRec.ownerName = &ownernametoget;
  71.     ownernametoget.bufSize = 259;
  72.     ASgetprivsRec.groupName = &groupnametoget;
  73.     groupnametoget.bufSize = 259;
  74.     
  75.     ASsetprivsRec.pCount = 6;
  76.     ASsetprivsRec.fstNum = appleShareFSID;
  77.     ASsetprivsRec.commandNum = ASSetPrivileges;
  78.     ASsetprivsRec.pathname = &foldertogetsetprivsof;
  79.     ASsetprivsRec.ownerName = &ownernametoset;
  80.     ownernametoset.bufSize = 259;
  81.     ASsetprivsRec.groupName = &groupnametoset;
  82.     groupnametoset.bufSize = 259;
  83.     
  84.     ASuserinfoRec.pCount = 5;
  85.     ASuserinfoRec.fstNum = appleShareFSID;
  86.     ASuserinfoRec.commandNum = ASUserInfo;
  87.     ASuserinfoRec.userName = &usernametoget;
  88.     usernametoget.bufSize = 259;
  89.     ASuserinfoRec.primaryGroupName = &usergroupnametoget;
  90.     usergroupnametoget.bufSize = 259;
  91.  
  92.     myGetDirEntryRec.pCount = 14;
  93.     myGetDirEntryRec.name = (ResultBuf255Ptr) &DirEntryResultBuf;
  94.     DirEntryResultBuf.bufSize = 32;
  95.     DirEntryNamePtr = &DirEntryResultBuf.bufString;
  96.     
  97.     SFpathresult.bufSize = 259; 
  98. }
  99.  
  100. void    initGlobals()
  101. {
  102.     int i;
  103.     
  104.     for (i = 0; i < 255; i++)   blanks[i] = ' ';        /* blank out string */
  105.     blanks[255] = (char) 0;
  106.     (ownernametoget.bufString).text[0] = (char) 0;      /* make strings null */
  107.     (groupnametoget.bufString).text[0] = (char) 0;
  108.     mysubsttext[1] = &(volname.text[1]);                /* init static text */
  109.     mysubsttext[2] = (usernametoget.bufString).text;    /* subst. ptrs      */
  110.     mysubsttext[3] = &(hastheseprivs[0]);
  111.     mysubsttext[4] = (ownernametoget.bufString).text;
  112.     mysubsttext[5] = (groupnametoget.bufString).text;
  113.  
  114.     DirEntryNamePtr->text[0] = (char) 0;
  115.                                             /* init ptr to Standard File str */
  116.     pathstrPtr = (GSString255Ptr) &(SFpathresult.bufString);
  117.  
  118.     power2[0] = 1;                    /* powers of 2 used to select bits 0-2 */
  119.     power2[1] = 2;
  120.     power2[2] = 4;
  121.     curaccessprivs = (GetAccessRightsRec) 0L;
  122.     initAShareFSTSpecificPBs();
  123.     userisowner = FALSE;
  124.     quitFlag = staggerCount = suppressErrors = 0;
  125. }
  126.